/*
 * Copyright 2015 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package navigator

import geb.test.GebSpecWithCallbackServer

class EqualsSpec extends GebSpecWithCallbackServer {

    def "equals implementations"() {
        given:
        responseHtml """
            <html>
                // tag::html[]
                <p class="a"></p>
                <p class="b"></p>
                // end::html[]
            </html>
        """

        when:
        go()

        then:
        // tag::equal[]
        assert $("div") == $(".foo") //<1>
        assert $(".a") == $(".a") //<2>
        assert $(".a") == $("p").not(".b") //<3>
        assert $("p") == $("p") //<4>
        assert $("p") == $(".a").add(".b") //<5>
        // end::equal[]
        // tag::not_equal[]
        assert $("div") != $("p") //<1>
        assert $(".a") != $(".b") //<2>
        assert $(".a").add(".b") != $(".b").add(".a") //<3>
        // end::not_equal[]
    }
}